package com.xiaouyudeguang.common.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaouyudeguang.common.dao.AbstractDao;
import com.xiaouyudeguang.common.request.RequestDto;
import org.springframework.data.domain.PageImpl;

import java.util.List;
import java.util.Set;

public interface AbstractService<Dao extends AbstractDao<T>, T> {

    /**
     * 根据id查询
     *
     * @return
     */
    T getById(String tenantId, String appId, String Id) throws Exception;

    /**
     * 批量查询
     *
     * @param tenantId
     * @param appId
     * @param ids
     * @return
     * @throws Exception
     */
    List<T> getByIds(String tenantId, String appId, Set<String> ids) throws Exception;

    /**
     * 根据id删除
     */
    Boolean deleteById(String tenantId, String appId, String Id) throws Exception;

    /**
     * 批量删除
     *
     * @param tenantId
     * @param appId
     * @param ids
     * @return
     */
    Boolean deleteByIds(String tenantId, String appId, Set<String> ids) throws Exception;

    /**
     * 根据id更新
     *
     * @return
     */
    Boolean updateById(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    Boolean updateByIds(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    Boolean updateBatch(String tenantId, String appId, List<T> dataList) throws Exception;
    /**
     * 修改
     *
     * @param tenantId
     * @param appId
     * @param requestDto
     * @return
     */
    Boolean modify(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    /**
     * 添加
     *
     * @return
     */
    T save(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    /**
     * 批量更新
     *
     * @param tenantId
     * @param appId
     * @param dataList
     * @return
     */
    Boolean saveBatch(String tenantId, String appId, List<T> dataList) throws Exception;

    /**
     * 单条查询
     *
     * @return
     */
    T getOne(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    /**
     * 列表查询
     *
     * @return
     */
    List<T> list(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    /**
     * 分页查询
     *
     * @return
     */
    PageImpl<T> page(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    /**
     * 分页查询
     *
     * @return
     */
    Page<T> pageAll(String tenantId, String appId, RequestDto<T> requestDto) throws Exception;

    /**
     * 批量添加
     *
     * @return
     */
    List<T> upload(String tenantId, String appId, List<T> dataList) throws Exception;

    List<T> export(String tenantId, String appId, RequestDto<T> doFill) throws Exception;
}
